import socket

# const int
OBJECT_IP = '127.0.0.1'
PORT = 84

udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)  # UDP协议

while True:
    data = input('input message:')  # 输入数据calc
    if data == 'q':
        break
    udp.sendto(data.encode("utf-8"), (OBJECT_IP, PORT))  # 发送数据并编码

udp.close()
if __name__ == '__main__':
    pass
